package cn.edu.scau.cmi.chenyaoquan.singleton;

import java.util.ArrayList;

public class Marshal {
	private	static	Marshal instance;
	private	String	name;
    private static ArrayList<Marshal> 	marshalList = new ArrayList<Marshal>();
	public	Marshal (String	name) {
		this.name = name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getName() {
		return name;
	}

	public	static	Marshal getInstance (String	name) {
		if(marshalList.size() < 10) {
			instance = new Marshal(name);
		marshalList.add(instance);
		return instance;
		}
		else
			return instance=null;
		
	}
	
}
